package org.ns.summer.example;

import org.apache.ibatis.ognl.security.UserMethod;
import org.ns.summer.beans.AnnotationApplicationContext;
import org.ns.summer.beans.ApplicationContext;
import org.ns.summer.beans.InitializingBean;
import org.ns.summer.beans.anns.Autowired;
import org.ns.summer.data.mybatis.DBSource;
import org.ns.summer.data.mybatis.EnableMybaitsTransacton;

@EnableMybaitsTransacton
public class StartMain implements InitializingBean {


    public static void main(String[] args) {
        ApplicationContext context = new AnnotationApplicationContext(StartMain.class);

    }

    @Autowired
    UserService userService;


    @Override
    public void afterPropertiesSet() throws Exception {

        userService.createUser(19999, "hhhhh");
        System.out.println(userService.getUserName(19999));
        System.out.println(userService.getMoney(19999));
        userService.delete(19999);

        userService.transferAccounts(123456, 888888,100);
        String userName = userService.getUserName(123456);
        long money = userService.getMoney(123456);
        System.out.println(String.format("用户名 %s，用户金额：%d", userName, money));

    }
}
